﻿@using JULONG.WEB.Library
@using YHWE.Web.Models
@model IEnumerable<YHWE.Web.Models.document>

@{
    ViewBag.Title = "Index";

    paging paging = new paging();
    paging.pageSize = 5;
    dynamic pagingMode;
    var vModel = paging.content(
        Model,
        out pagingMode, Html.getRoute("page").As<int>()
        );
    ViewBag.paging = pagingMode;
    documentType dctype = ViewBag.channel;

    string typeIco = "";
    if (dctype.ID == 1)
    {

        typeIco = "schoolDynamicTitle.jpg";
    }
    else
    {
        typeIco = "photoAlbum.jpg";
    }    
}
<img src="/Content/images/@typeIco" style=" float:left;" />

<ul class="contentList" style="margin:0px; margin-left:160px;">
@foreach (var item in vModel)
{
    string content = item.content ?? "";
    content = content.reHtmlCode();
    if (content.Length > 80)
    {
        content = content.Substring(0, 80);
    }
        <li style="background:url(/Content/images/titleLine.png) bottom left; padding-bottom:10px; background-repeat:no-repeat; ">
        @if (String.IsNullOrWhiteSpace(dctype.value))
        {

            if (dctype.ID == 1)
            {
                <span class="datetime">@item.datetime.ToString("yyyy-M-d")</span>
                <a href="/document/show/@item.ID" target="_blank" class="title">@item.title</a>
                <br/>
            }
            else
            {
                <a href="/document/show/@item.ID" target="_blank" class="title">@item.title</a>  <span class="datetime2">@item.datetime.ToString("yyyy-M-d")</span>
                <br/>
                if (!String.IsNullOrWhiteSpace(item.ext))
                {
                    var thums = @item.ext.Split(',').Take(3);
                    foreach (var _thumImg in thums)
                    {
                        <a href="/Content/uploads/document/@_thumImg" target="_blank"><img src="/Content/uploads/document/thumbnail/@_thumImg" /></a>
                    }
                }
                <a href="/document/show/@item.ID" target="_blank" class="title" style="width:60px; padding-right:100px; margin-top:-20px; float:right; right:0px">>详情</a>
                <br/>

            }
        }
        else
        {
            @Html.Raw(dctype.value.Replace("{content}", content.reHtmlCode()).Replace("{datetime}", @item.datetime.ToString("yyyy-M-d")).Replace("{id}", item.ID.ToString()).Replace("{title}", item.title))
        }

        </li>


}

</ul>
@Html.Partial("paging", new { action = "Index" })
<div class="clearFloat"></div>

